import { ILoading } from "./ILoading";

export class LoadingOne {

    next: LoadingOne[] = [];

    constructor(
        public loading: ILoading,
    ) {
        loading.target = this;
    }

    addNext(loading: LoadingOne): void {
        if (!loading) {
            return;
        }
        this.next.push(loading);
    }

    onLoadingCompleted(): void {
        for (const n of this.next) {
            n.loading.load();
        }
    }

}